#pragma once
#include "../../../utils/common_ptr.h"

/**
 * 二元操作符
 */
class SQLBinaryOperator
{
public:
  static SQLBinaryOperator Union;
  static SQLBinaryOperator COLLATE;
  static SQLBinaryOperator BitwiseXor;
  static SQLBinaryOperator BitwiseXorEQ;
  static SQLBinaryOperator Multiply;
  static SQLBinaryOperator Divide;
  static SQLBinaryOperator DIV; // mysql integer division
  static SQLBinaryOperator Modulus;
  static SQLBinaryOperator Mod;
  static SQLBinaryOperator Add;
  static SQLBinaryOperator Subtract;
  static SQLBinaryOperator SubGt;
  static SQLBinaryOperator SubGtGt;
  static SQLBinaryOperator PoundGt;
  static SQLBinaryOperator PoundGtGt;
  static SQLBinaryOperator QuesQues;
  static SQLBinaryOperator QuesBar;
  static SQLBinaryOperator QuesAmp;
  static SQLBinaryOperator LeftShift;
  static SQLBinaryOperator RightShift;
  static SQLBinaryOperator BitwiseAnd;
  static SQLBinaryOperator BitwiseOr;
  static SQLBinaryOperator GreaterThan;
  static SQLBinaryOperator GreaterThanOrEqual;
  static SQLBinaryOperator Is;
  static SQLBinaryOperator LessThan;
  static SQLBinaryOperator LessThanOrEqual;
  static SQLBinaryOperator LessThanOrEqualOrGreaterThan;
  static SQLBinaryOperator LessThanOrGreater;
  static SQLBinaryOperator IsDistinctFrom;
  static SQLBinaryOperator IsNotDistinctFrom;
  static SQLBinaryOperator Like;
  static SQLBinaryOperator SoudsLike;
  static SQLBinaryOperator NotLike;
  static SQLBinaryOperator ILike;
  static SQLBinaryOperator NotILike;
  static SQLBinaryOperator AT_AT; // postgresql textsearch
  static SQLBinaryOperator SIMILAR_TO;
  static SQLBinaryOperator POSIX_Regular_Match;
  static SQLBinaryOperator POSIX_Regular_Match_Insensitive;
  static SQLBinaryOperator POSIX_Regular_Not_Match;
  static SQLBinaryOperator POSIX_Regular_Not_Match_POSIX_Regular_Match_Insensitive;
  static SQLBinaryOperator Array_Contains;
  static SQLBinaryOperator Array_ContainedBy;
  static SQLBinaryOperator SAME_AS;
  static SQLBinaryOperator JSONContains;
  static SQLBinaryOperator RLike;
  static SQLBinaryOperator NotRLike;
  static SQLBinaryOperator NotEqual;
  static SQLBinaryOperator NotLessThan;
  static SQLBinaryOperator NotGreaterThan;
  static SQLBinaryOperator IsNot;
  static SQLBinaryOperator Escape;
  static SQLBinaryOperator RegExp;
  static SQLBinaryOperator NotRegExp;
  static SQLBinaryOperator Equality;
  static SQLBinaryOperator BitwiseNot;
  static SQLBinaryOperator Concat;
  static SQLBinaryOperator BooleanAnd;
  static SQLBinaryOperator BooleanXor;
  static SQLBinaryOperator BooleanOr;
  static SQLBinaryOperator Assignment;
  static SQLBinaryOperator PG_And;
  static SQLBinaryOperator PG_ST_DISTANCE;

  static int getPriority(SQLBinaryOperator_ptr operator_);

  string_ptr name;
  string_ptr nameLCase;
  int priority;

  SQLBinaryOperator(string_ptr name, int priority);
  SQLBinaryOperator(SQLBinaryOperator *sqlBinaryOperator);

  string_ptr getName()
  {
    return this->name;
  }

  int getPriority()
  {
    return this->priority;
  }

  bool isRelational();

  bool isLogical()
  {
    return this->name->c_str() == BooleanAnd.name->c_str() ||
           this->name->c_str() == BooleanOr.name->c_str() ||
           this->name->c_str() == BooleanXor.name->c_str();
  }

  bool isArithmetic();
};
